﻿<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/lib/layui-v2.2.5/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="/h-ui.admin/css/style.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>新增接口</title>
    <script>
        var _hmt = _hmt || [];
        (function () {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?66eb41787f05b9755f31623b0d2a8d6e";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
</head>
<body>
<div class="page-container">
    <form class="form form-horizontal" id="form-article-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>接口名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${api.apiName}" placeholder="" id="api_name"/>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>接口地址：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${api.apiUrl}" placeholder="" id="api_url"/>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>所属项目：</label>
            <div class="formControls col-xs-4 col-sm-4">
					<span class="select-box"> <select id="selSubject" class="select">
					</select>
					</span>
            </div>
            <div class="formControls col-xs-4 col-sm-5">
                <button class="btn btn-primary radius" type="button" onclick="addSubject();">新增项目</button>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">所属分类：</label>
            <div class="formControls col-xs-4 col-sm-4">
					<span class="select-box"> <select id="selType" class="select">
					</select>
					</span>
            </div>
            <div class="formControls col-xs-4 col-sm-5">
                <button class="btn btn-primary radius" type="button" onclick="addType();">新增分类</button>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">请求类型：</label>
            <div class="formControls col-xs-4 col-sm-4">
					<span class="select-box"> 
					<select class="select" id="requestType">
							<option value="POST/GET"
                                    th:selected="${api.apiRequestType=='POST/GET'}?selected">POST/GET</option>
							<option value="POST" th:selected="${api.apiRequestType=='POST'}?selected">POST</option>
							<option value="GET" th:selected="${api.apiRequestType=='GET'}?selected">GET</option>
					</select>
					</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">请求参数:</label>
            <div class="formControls col-xs-8 col-sm-9">
                <button class="btn btn-primary radius" type="button" onclick="addParams();">新增</button>
                <table class="layui-table" id="paramsTable">
                    <colgroup>
                        <col width="150"/>
                        <col width="150"/>
                        <col width="150"/>
                        <col/>
                        <col width="80"/>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>参数</th>
                        <th>是否必填</th>
                        <th>类型</th>
                        <th>说明</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="content">

                    <!-- 如果没有数据就加载默认 -->
                    <tr th:if="${paramsList.isEmpty()}">
                        <td><input type="text" class="input-text" value="" placeholder="" id="" name=""/></td>
                        <td>
					      	<span class="select-box">
							<select name="" class="select">
								<option value="是">是</option>
								<option value="否">否</option>
							</select>
							</span>
                        </td>
                        <td>
					      	<span class="select-box">
							<select name="" class="select">
								<option value="header">header</option>
								<option value="param">param</option>
							</select>
							</span>
                        </td>
                        <td><input type="text" class="input-text" value="" placeholder="" id="" name=""/></td>
                        <td>
                            <a style="text-decoration:none" class="ml-5" onClick="api_del(this,'10001')"
                               href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>
                        </td>
                    </tr>
                    <tr th:each="apiParams,apiParamsStat : ${paramsList}">
                        <td><input type="text" class="input-text" th:value="${apiParams.paramName}" placeholder="" id=""
                                   name=""/></td>
                        <td>
								<span class="select-box">
								<select name="" class="select">
										<option value="是" th:selected="${apiParams.paramType=='是'}?selected">是</option>
										<option value="否" th:selected="${apiParams.paramType=='否'}?selected">否</option>
								</select>
								</span>
                        </td>
                        <td>
						  	<span class="select-box">
  							<select name="" class="select">
  								<option value="header"
                                        th:selected="${apiParams.paramBoolean=='header'}?selected">header</option>
								<option value="param"
                                        th:selected="${apiParams.paramBoolean=='param'}?selected">param</option>
							</select>
							</span>
                        </td>
                        <td><input type="text" class="input-text" th:value="${apiParams.paramRemark}" id="" name=""/>
                        </td>
                        <td>
                            <a class="layui-icon" title="删除">&#xe640;</a>
                        </td>
                    </tr>


                    </tbody>
                </table>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">返回结果:</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea id="apiResult" required lay-verify="required" rows="20" placeholder="请输入返回结果"
                          th:text="${api.apiResult}" class="layui-textarea"></textarea>
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button onClick="api_save();" class="btn btn-primary radius" type="button">
                    <i class="Hui-iconfont">&#xe632;</i> 保存
                </button>

                <button onClick="layer_close();" class="btn btn-default radius" type="button">
                    &nbsp;&nbsp;取消&nbsp;&nbsp;
                </button>
            </div>
        </div>
    </form>
</div>
<!-- 隐藏域 -->
<input id="hid_id" type="hidden" th:value="${api.id}"/>
<input type="hidden" id="hid_subject_id" th:value="${api.apiSubjectId}"/>
<input type="hidden" id="hid_type_id" th:value="${api.apiTypeId}"/>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/js/template.js"></script>
<script type="text/javascript" src="/js/api-edit.js"></script>
</body>
</html>